package com.wu.flandre.component;

import com.wu.flandre.entity.common.ApiCallMsgRecordEntity;
import com.wu.flandre.service.ApiCallCensusService;
import com.wu.flandre.service.ApiCallErrorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 微信客户端发消息,异步记录
 *
 * @author 50816
 * @date 2019年12月1日 18:39:31
 */
@Async("getThreadPoolExecutor")
@Component
@Slf4j
public class MsgRecord {

    @Autowired
    private ApiCallCensusService apiCallCensusService;
    @Autowired
    private ApiCallErrorService apiCallErrorService;


    public void apiCallMsgRecord(ApiCallMsgRecordEntity recordEntity) {
        apiCallCensusService.apiCallInfoRecordDataBase(recordEntity);
    }

    public void apiErrorLogRecord(String logMessage, String uri) {
        apiCallErrorService.recordAopErrorLog(logMessage, uri);
    }
}
